<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.wxtf.platform.plugins.user.*"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
	UserBean user = (UserBean)request.getSession().getAttribute("userBean");
	
	String _db = user.getDbType();
	Map<String,List<Map<String, String>>> dicMap = user.getDicMap();
	List<Map<String, String>> list = null;
	String temp = "";
	
	String tbe_employment_forms = "";//用工形式
	String tbe_nation = "";//民族
	String tbe_marital_status = "";//婚姻状态
	String tbe_status = "";//员工状态
	String tbe_status1 = "";//员工状态
	String tbe_birth_control_measures = "";//节育措施
	String tbe_es_reason="";//重点理由
	
	list = dicMap.get("101");
	if(null != list && list.size() > 0){
		for(Map<String, String> map: list){
			if("31".equals(map.get("tmgd_id"))){
				continue;
			}
			tbe_employment_forms += "<option value=\"" + map.get("tmgd_id")+"\">" + map.get("tmgd_name") + "</option>";
		}
	}
	list = null;
	list = dicMap.get("5");
	if(null != list && list.size() > 0){
		for(Map<String, String> map: list){
			tbe_nation += "<option value=\"" + map.get("tmgd_id")+"\">" + map.get("tmgd_name") + "</option>";
		}
	}
	list = null;
	list = dicMap.get("27");
	if(null != list && list.size() > 0){
		for(Map<String, String> map: list){
			tbe_marital_status += "<option value=\"" + map.get("tmgd_id")+"\">" + map.get("tmgd_name") + "</option>";
		}
	}
	list = null;
	list = dicMap.get("102");
	if(null != list && list.size() > 0){
		for(Map<String, String> map: list){
			if("102-1".equals( map.get("tmgd_id")) || "102-2".equals( map.get("tmgd_id")) || "102-4".equals( map.get("tmgd_id"))){
				tbe_status1 += "<option value=\"" + map.get("tmgd_id")+"\">" + map.get("tmgd_name") + "</option>";
			}
			tbe_status += "<option value=\"" + map.get("tmgd_id")+"\">" + map.get("tmgd_name") + "</option>";
		}
	}
	list = null;
	list = dicMap.get("104");
	if(null != list && list.size() > 0){
		String temp1 = "";
		for(Map<String, String> map: list){
			tbe_birth_control_measures += "<option value=\"" + map.get("tmgd_id")+"\">" + map.get("tmgd_name") + "</option>";
		}
		tbe_birth_control_measures = temp1 + tbe_birth_control_measures;
	}
	list = null;
	list = dicMap.get("107");
	if(null != list && list.size() > 0){
		for(Map<String, String> map: list){
			tbe_es_reason += "<option value=\"" + map.get("tmgd_id")+"\">" + map.get("tmgd_name") + "</option>";
		}
	}
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>人员管理</title>
		<base href="<%=basePath%>"/>
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta http-equiv="pragma" content="no-cache"/>
		<meta http-equiv="cache-control" content="no-cache"/>
		<meta http-equiv="expires" content="0"/>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

		<link type="text/css" rel="stylesheet" href="ligerUI/skins/Aqua/css/ligerui-all.css" />
		<link type="text/css" rel="stylesheet" href="ligerUI/skins/<%=user.getUserCss()%>/css/ligerui-all.css" />
		<link type="text/css" rel="stylesheet" href="ligerUI/skins/ligerui-icons.css" />
		<link type="text/css" rel="stylesheet" href="resource/css/style.css" />

		<script type="text/javascript" src="js/jquery/jquery-1.7.2.js"></script>
		<script type="text/javascript" src="ligerUI/js/core/base.js"></script>
		<script type="text/javascript" src="ligerUI/js/ligerui.min.js"></script>
		<script type="text/javascript" src="js/common.js"></script>
		<script type="text/javascript" src="js/validata.js"></script>

		<script type="text/javascript" src="ligerUI/js/plugins/ligerGrid.js"></script>
		<script type="text/javascript" src="ligerUI/js/plugins/ligerTree.js"></script>
		<script type="text/javascript" src="ligerUI/js/plugins/ligerForm.js"></script>
		<script type="text/javascript" src="ligerUI/js/plugins/ligerDateEditor.js"></script>
		
		
<script type="text/javascript">
var _db = '<%=_db%>';

_jsonObj.classname = "com.wxtf.platform.main.employee.EmployeeAction";
_jsonObj.methodname = "queryPage";
_jsonObj.logicdata = "[{\"types\":\"init\"}]";


var win;//人员新建/修改弹出框
var win2;//高级检索弹出框
var win3;//机构弹出框
var win4;//机构弹出框
var manager;//人员表格
var arraySerarchList = new Array();//高级搜索条件数组

$(function(){
	manager = $("#emp-grid").ligerGrid({
		url: _url, parms: _jsonObj, width: '100%', height: '100%',
		usePager: true, rownumbers: true, checkbox: true, alternatingRow: true,
		columns: [
			{ display: 'tbe_id', name: 'tbe_id', hide: true,width:1 },
			{ display: 'org_id', name: 'org_id', hide: true,width:1 },
			{ display: '机构名称', name: 'reserve1', width:150, align:'left' },
			{ display: '姓名', name: 'tbe_name', width: 80, align: 'left' ,render: function(record, index, value, oth){
					return " <a href='javascript:addData(" + JSON.stringify(record) + ")'>"+value+"</a>";
				}},
			{ display: '性别', name: 'tbe_sex', width: 40, align: 'align' },
			{ display: '年龄', name: 'tbe_age', width: 1, hide:true },
			{ display: '出生日期', name: 'tbe_birthday', width: 100, align: 'left' },
			{ display: '民族', name: 'tbe_nation', width:  1, hide:true },
			{ display: '身份证号', name: 'tbe_idcard', width: 180, align: 'left' },
			{ display: '职工证号', name: 'tbe_work_permit', width: 1, hide:true },
			{ display: '用工形式', name: 'tbe_employment_forms', width:  1, hide:true },
			{ display: '曾用名', name: 'tbe_former_name', hide: true,width:1},
			{ display: '职称', name: 'tbe_spell_code', hide: true,width:1},
			{ display: '出生地', name: 'tbe_birthplace',hide: true,width:1},
			{ display: '入厂时间', name: 'tbe_join_time', width:  1, hide:true },
			{ display: '工龄', name: 'tbe_seniority', width:  1, hide:true },
			{ display: '手机', name: 'tbe_mobile', width: 1, hide:true },
			{ display: '家庭电话', name: 'tbe_family_phone', width: 100, align: 'left' },
			{ display: '家庭住址', name: 'tbe_address', width: 200, align: 'left' },
			{ display: '籍贯', name: 'tbe_native_palce', width: 1, hide:true, align: 'left' },
			{ display: '婚姻状态', name: 'tbe_marital_status', width: 80, align: 'left',
				render: function(record, index, value, oth){
					<%
					list = dicMap.get("27");
					temp = "";
					if(null != list && list.size() > 0){
						for(Map<String, String> map: list){
					%>
					if(value == '<%=map.get("tmgd_id")%>'){
						<%
						temp = map.get("tmgd_name");
						%>
						return '<%=temp%>';
					}
					<%
						}
					}
					%>
					return value;
				}
			},
			{ display: '婚姻状况', name: 'tbe_marital_condition', width: 1, hide:true },
			{ display: '结婚时间', name: 'tbe_married_time', width:  1, hide:true },
			{ display: '结婚证号', name: 'tbe_marriage_certificate', width:  1, hide:true },
			{ display: '政治面貌', name: 'tbe_political_status', width:  1, hide:true },
			{ display: '文化程度', name: 'tbe_qualification', width:  1, hide:true },
			{ display: '毕业学校', name: 'tbe_graduate_college', width:  1, hide:true },
			{ display: '所学专业', name: 'tbe_major', width:  1, hide:true },
			{ display: '工作时间', name: 'tbe_work_area', width:  1, hide:true },
			{ display: '职务', name: 'tbe_position', width:  1, hide:true },
			{ display: '是否允许再生育', name: 'tbe_is_again_birth', width:  1, hide:true },
			{ display: '是否不孕症', name: 'tbe_is_barrenness', width:  1, hide:true },
			{ display: '是否绝经', name: 'the_is_menopause', width:  1, hide:true },
			{ display: '是否晚婚', name: 'tbe_is_late_marriage', width:  1, hide:true },
			{ display: '是否晚育', name: 'tbe_is_late_birth', width:  1, hide:true },
			{ display: '员工状态', name: 'tbe_status', width:  1, hide:true },
			{ display: '生育能力状态', name: 'tbe_ba_status', width:  1, hide:true },
			{ display: '节育措施', name: 'tbe_birth_control_measures', width:  1, hide:true },
			{ display: '设为重点时间', name: 'tbe_es_time', width:  1, hide:true },
			{ display: '是否重点服务对象', name: 'tbe_is_es', width:  1, hide:true },
			{ display: '重点理由', name: 'tbe_es_reason', width:  1, hide:true },
			{ display: '子女情况', name: 'tbe_children_status', width:  1, hide:true },
			{ display: '排序号', name: 'tbe_order', width:  1, hide:true },
			{ display: '备注', name: 'tbe_memo', width:  1, hide:true },
			{ display: 'reserve2', name: 'reserve2', width:  1, hide:true },
			{ display: 'reserve3', name: 'reserve3', width:  1, hide:true },
			{ display: 'reserve4', name: 'reserve4', width:  1, hide:true },
			{ display: 'reserve5', name: 'reserve5', width:  1, hide:true },
			{ display: '录入人', name: 'create_by', width:  1, hide:true },
			{ display: '录入时间', name: 'create_time', width:  1, hide:true },
			{ display: '最后修改人', name: 'last_modify_by', width:  1, hide:true },
			{ display: '最后修改时间', name: 'last_modify_time', width: 1, hide:true },
			{ display: '编辑', name:'edit',width:60,isSort:false,render: function(record, index, value, oth){
					return "<img src='ligerUI/skins/icons/edit.gif' onclick='addData(" + JSON.stringify(record) + ")'></img>";
				}
			},
			{ display: '转到婚姻', name:'edit',width:80,isSort:false,render: function(record, index, value, oth){
					return "<img src='ligerUI/skins/icons/017.gif' onclick='dispatchMarry(\"" + record.tbe_name + "\")'></img>";
				}
			}
		],
		toolbar: {
			items: [
				{ text: '新建', click: function(){ addData(); }, icon: 'add' },
				{ line: true },
				{ text: '删除', click: function(){ delData(); },icon: 'delete'}
			]
		}
	});

	
	/*
	 * 日期框
	 */
	$("#tbe_birthday").ligerDateEditor({ format: "yyyy-MM-dd", width:182 });
	$("#tbe_work_area").ligerDateEditor({ format: "yyyy-MM-dd", width:182});
	$("#tbe_join_time").ligerDateEditor({ format: "yyyy-MM-dd", width:182});
	$("#tbe_es_time").ligerDateEditor({ format: "yyyy-MM-dd", width:182});
	
});


/*
 * ajax成功回调
 */
function ajaxCallbackSuccFunc(data, textStatus){
	serch1();
	if(data.result || data.result == 'true'){
		succMsgTip(data.resultrecord);
	}else{
		warningTip(data.resultrecord);
	}
	if(win && data.result){
		win.hide();
	}
}

/*
 * ajax失败回调
 */
function ajaxCallbackErrorFunc(data, textStatus){
	warningTip(data.resultrecord);
}

/*
 * 获取列表选中的人员ID
 */
function getUserIds(){
	var arrayUsers = manager.getSelecteds();
	if(arrayUsers.length == 0){
		return "";
	} else {
		var text = "";
		for(var i=0; i<arrayUsers.length; i++){
			text += arrayUsers[i].tbe_id + ",";
		}
		return text.substring(0, text.length - 1);
	}
}

/*
 * 新增/修改人员
 */
function addData(row){
	document.getElementById('emp-form').reset();
	if(row){
		if(row.tbe_sex == '男'){
			$("#tbe_sex").html('<option value="男">男</option>');
		}else{
			$("#tbe_sex").html('<option value="女">女</option>');
		}
		loadForm("emp-form", row);
		<%
		list = dicMap.get("27");
		if(null != list && list.size() > 0){
			for(Map<String, String> map: list){
		%>
			if(row.tbe_marital_status == '<%=map.get("tmgd_id")%>'){
				$("#tbe_marital_status_text").val('<%=map.get("tmgd_name")%>');
			}
		<%
			}
		}
		%>
		$("#orgNameText").val(row.reserve1);
	} else {
		$("#tbe_marital_status").val('8A90F0D0176C4961B322BEB26703A320');
		$("#tbe_marital_status_text").val('未婚');
		$("#tbe_id").val('');
		$("#tbe_sex").html('<option value="男">男</option><option value="女">女</option>');
	}
	
	if(win == null){
		if('<%=user.getUserId()%>' == '3baf3bb603e04d0688053555b0234b46'
			||'<%=user.getUserId()%>' == '3df87eb3973f4eba8fa851686ceba0f6'
				||'<%=user.getUserId()%>' == 'defd78b884d744dcb55f123638dfdd4d'){
			win = initWindowByDiv2('empAdd-div', '查看人员', 880, 450, closeWin);
		}else{
			win = initWindowByDiv('empAdd-div', '编辑人员', 880, 450, save, closeWin);
		}
	}else{
		win.show();
	}
}
	
/*
 * 新建/修改人员信息
 */
function save(){
	var tbe_name = $("#tbe_name").val().trim();
	var tbe_idcard = $("#tbe_idcard").val().trim();
	var tbe_birthday = $("#tbe_birthday").val().trim();
	var tbe_native_palce = $("#tbe_native_palce").val().trim();
	var tbe_address = $("#tbe_address").val().trim();
	var tbe_family_phone = $("#tbe_family_phone").val().trim();
	var tbe_work_permit = $("#tbe_work_permit").val().trim();
	var tbe_spell_code = $("#tbe_spell_code").val().trim();
	var tbe_qualification = $("#tbe_qualification").val().trim();
	var tbe_memo = $("#tbe_memo").val().trim();

	if('' == tbe_name){warningTip("姓名：不能为空"); return;}
	if(!checkIsString(tbe_name)){
		warningTip("姓名：必须为字母、数字、下划线、中文组成");
		return;
	}
	if(fucCheckLength(tbe_name) > 32){
		warningTip("姓名：不能超过32字符");
		return;
	}
	
	if('' == tbe_idcard){warningTip("身份证：不能为空"); return;}
	if(!checkIsString(tbe_idcard)){
		warningTip("身份证：必须为字母、数字、下划线、中文组成");
		return;
	}
	if(fucCheckLength(tbe_idcard) > 32){
		warningTip("身份证：不能超过32字符");
		return;
	}
	
	if('' == tbe_birthday){warningTip("出生日期：不能为空"); return;}
	if(!checkIsString(tbe_native_palce)){
		warningTip("籍贯：必须为字母、数字、下划线、中文组成");
		return;
	}
	if(fucCheckLength(tbe_native_palce) > 64){
		warningTip("籍贯：不能超过64字符");
		return;
	}
	
	if(!checkIsString(tbe_address)){
		warningTip("家庭住址：必须为字母、数字、下划线、中文组成");
		return;
	}
	if(fucCheckLength(tbe_address) > 128){
		warningTip("家庭住址：不能超过128字符");
		return;
	}
	if(fucCheckLength(tbe_family_phone) > 32){
		warningTip("家庭住址：不能超过32字符");
		return;
	}
	if(!checkIsTelephone(tbe_family_phone)){
		warningTip("家庭电话：格式应为12345678、0431-12345678、0431-12345678-12345");
		return;
	}
	
	if(!checkIsString(tbe_work_permit)){
		warningTip("职工证号：必须为字母、数字、下划线、中文组成");
		return;
	}
	if(fucCheckLength(tbe_work_permit) > 64){
		warningTip("职工证号：不能超过64字符");
		return;
	}
	
	if(!checkIsString(tbe_spell_code)){
		warningTip("职务：必须为字母、数字、下划线、中文组成");
		return;
	}
	if(fucCheckLength(tbe_spell_code) > 32){
		warningTip("职务：不能超过32字符");
		return;
	}
	
	if(!checkIsString(tbe_qualification)){
		warningTip("文化程度：必须为字母、数字、下划线、中文组成");
		return;
	}
	if(fucCheckLength(tbe_qualification) > 32){
		warningTip("文化程度：不能超过32字符");
		return;
	}
	
	if(!checkIsString(tbe_memo)){
		warningTip("备注：必须为字母、数字、下划线、中文组成");
		return;
	}
	if(fucCheckLength(tbe_memo) > 512){
		warningTip("备注：不能超过512字符");
		return;
	}
	
	
	var text = document.getElementById('org_id');
	text = text.options[text.selectedIndex].text.replaceAll('-','');
	$('#reserve1').val(text);
	_jsonObj.logicdata = getForm("emp-form");
	
	var tbe_id = $("#tbe_id").val();
	if(tbe_id == ''){
		_jsonObj.methodname = "save";
		callserver(_jsonObj, ajaxCallbackSuccFunc, ajaxCallbackErrorFunc);
	} else {
		_jsonObj.methodname = "update";
		callserver(_jsonObj, ajaxCallbackSuccFunc, ajaxCallbackErrorFunc);
	}
}
/*
 * 删除人员
 */
function delData(){
	var userIds = getUserIds();
	if(userIds == ""){
		warningTip('请至少选择一个用户进行操作');
		return;
	}
	$.ligerDialog.confirm('确定要删除选中的数据吗？（删除不可恢复）', function (opt) { 			
		if(opt){
			_jsonObj.methodname = "delete";
			_jsonObj.logicdata = "[{\"ids\":\"" + userIds + "\"}]";
			callserver(_jsonObj, ajaxCallbackSuccFunc, ajaxCallbackErrorFunc);
		}
	});
}

/*
 * 导出
 */
function expData(){
	var orgIds = $('#org2').val();
	var tbe_employment_forms = $('#ser5').val();
	var tbe_name = $('#ser1').val();
	var tbe_idcard = $('#ser4').val();
	var tbe_birth_control_measures = $('#ser6').val();
	var tbe_is_late_marriage = $('#ser7').val();
	
	_jsonObj.methodname = "expData";
	_jsonObj.logicdata = '[{\"orgIds\":\"' + orgIds + '\",\"tbe_employment_forms\":\"' + tbe_employment_forms
			 + '\",\"tbe_name\":\"' + tbe_name + '\",\"tbe_idcard\":\"' + tbe_idcard
			 + '\",\"tbe_birth_control_measures\":\"'+tbe_birth_control_measures
			 + '\",\"tbe_is_late_marriage\":\"'+tbe_is_late_marriage+'\",\"types\":\"serch1\"}]';

	callserver(_jsonObj, function(data, textStatus){
		if(data.result){
			downloadFile(data.resultrecord);
		} else {
			warningTip(data.resultrecord);
		}
		serch1();
	}, function(data, textStatus){
		warningTip(data.resultrecord);
	});
}

/*
 * 跳转到婚姻
 */
function dispatchMarry(name){
	var tabId = '_tab_b5e3ea75afca4c399b2469e5ab8fe8a8';
	parent.removeTab(tabId);
	parent.f_addTab(tabId, '人员婚姻管理', 'jsp/app/empMarital.jsp?name=' + encodeURI(encodeURI(name)));
}

/*
 * 条件查询
 */
function serch1(){
	var orgIds = $('#org2').val();
	var tbe_employment_forms = $('#ser5').val();
	var tbe_name = $('#ser1').val();
	var tbe_idcard = $('#ser4').val();
	var tbe_birth_control_measures = $('#ser6').val();
	var tbe_is_late_marriage = $('#ser7').val();
	
	_jsonObj.methodname = "queryPage";
	_jsonObj.logicdata = '[{\"orgIds\":\"' + orgIds + '\",\"tbe_employment_forms\":\"' + tbe_employment_forms
			 + '\",\"tbe_name\":\"' + tbe_name + '\",\"tbe_idcard\":\"' + tbe_idcard
			 + '\",\"tbe_birth_control_measures\":\"'+tbe_birth_control_measures
			 + '\",\"tbe_is_late_marriage\":\"'+tbe_is_late_marriage+'\",\"types\":\"serch1\"}]';
	manager.loadData();
}

/*
 * 高级查询
 */
function serch2(){
	if(win2 == null){
		win2 = initWindowByDiv('tallSearch','高级查询', 670, 454, function(){
			var tableName = "";
        	var objArrayOne = $("[name=luojiOne]");
        	var objArrayTwo = $("[name=luojiTwo]");
        	var arrayColsName = $("[name=colsName]");
        	var arrayColsValue = $("[name=colsValue]");
        	
        	var tempSearch = "";
        	for(var i=0; i<arrayColsName.length; i++){
        		var conditionValue = objArrayOne[i+1].value;
        		if(conditionValue == "like"){
		        	arraySerarchList.push(" " + objArrayTwo[i+1].value+" "+tableName+arrayColsName[i].value+" "+objArrayOne[i+1].value+" '%"+arrayColsValue[i].value+"%' ");
        		}else if(conditionValue == "in"){
        			var strArr = arrayColsValue[i].value.split(",");
        			var tempStr = "";
        			for(var j=0; j<strArr.length; j++){
        				tempStr +="'"+strArr[j]+"',";
        			}
		        	arraySerarchList.push(" " + objArrayTwo[i+1].value+" "+tableName+arrayColsName[i].value+" "+objArrayOne[i+1].value+" ("+tempStr.substring(0,tempStr.length-1)+") ");
        		}else if(conditionValue == "between"){
        			var strArr = arrayColsValue[i].value.split(",");
		        	arraySerarchList.push(" " + objArrayTwo[i+1].value+" "+tableName+arrayColsName[i].value+" "+objArrayOne[i+1].value+" '"+strArr[0]+"' and '"+strArr[1]+"' ");
        		}else if(conditionValue == "is null"){
		        	arraySerarchList.push(" " + objArrayTwo[i+1].value+" "+tableName+arrayColsName[i].value+" "+objArrayOne[i+1].value+" ");
        		}else{
		        	arraySerarchList.push(" " + objArrayTwo[i+1].value+" "+tableName+arrayColsName[i].value+" "+objArrayOne[i+1].value+" '"+arrayColsValue[i].value+"' ");
        		}
        	}
        	
        	var whereAnd = "";
        	for(var i=0;i<arraySerarchList.length;i++){
        		whereAnd += arraySerarchList[i];
        	}
        	
        	_jsonObj.methodname = "queryPage";
			_jsonObj.logicdata = '[{\"where\":\"' + whereAnd + '\",\"types\":\"serch2\"}]';
			manager.loadData();
        	
        	arraySerarchList.length = 0;
        	win2.hide();
        	
		},closeWin);
	}else{
		win2.show();
	}
}

/*
 * 动态给table添加一个tr-高级查询
 */
function tallSearchCols(clValue){
	var bool = false;
	var arrayColsName = $("[name=colsName]");
	var conHtml = '<select name="luojiTwo"><option value="and">与</option></select>';
	
	for(var i=0; i<arrayColsName.length; i++){
		if(clValue == arrayColsName[i].value){
			bool = true;
			break;
		}
	}
	if(bool){
		conHtml = $("#conditionAnd").html();
	}
	
	var clName = $("option[value='" + clValue + "']").eq(0).text()
	if(clValue=="tbe_birthday" || clValue=="tbe_married_time"|| clValue=="tbe_work_area" || clValue=="tbe_es_time" ){
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="180px"><input name="colsValue" class="times" type="text" onkeyup="this.value=formatdata(this.value);"></td><td width="90px">'+conHtml+'</td><td width="60px" style="cursor: pointer;" onClick="getDel(this)">删除</td></tr>');
		$(".times").ligerDateEditor({width :150});
	}else if(clValue=="tbe_is_es" || clValue=="tbe_is_barrenness" || clValue=="the_is_menopause" || clValue=="tbe_is_again_birth" || clValue=="tbe_is_late_birth" || clValue=="tbe_is_late_marriage"){
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="180px"><select name="colsValue" type="text" style="width:150px"><option value="1">是</option><option value="0">否</option></select></td><td>'+conHtml+'</td><td style="cursor: pointer;" width="60px" onClick="getDel(this)">删除</td></tr>');
	}else if(clValue=="tbe_sex"){
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="180px"><select name="colsValue" type="text" style="width:150px"><option value="男">男</option><option value="女">女</option></select></td><td>'+conHtml+'</td><td style="cursor: pointer;" width="60px" onClick="getDel(this)">删除</td></tr>');
	}else if(clValue == 'tbe_employment_forms'){
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="180px"><select name="colsValue" type="text" style="width:150px"><%=tbe_employment_forms%></select></td><td>'+conHtml+'</td><td style="cursor: pointer;" width="60px" onClick="getDel(this)">删除</td></tr>');
	} else if(clValue == 'tbe_nation'){
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="180px"><select name="colsValue" type="text" style="width:150px"><%=tbe_nation%></select></td><td>'+conHtml+'</td><td style="cursor: pointer;" width="60px" onClick="getDel(this)">删除</td></tr>');
	} else if(clValue == 'tbe_marital_status'){
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="180px"><select name="colsValue" type="text" style="width:150px"><%=tbe_marital_status%></select></td><td>'+conHtml+'</td><td style="cursor: pointer;" width="60px" onClick="getDel(this)">删除</td></tr>');
	} else if(clValue == 'tbe_status'){
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="180px"><select name="colsValue" type="text" style="width:150px"><%=tbe_status%></select></td><td>'+conHtml+'</td><td style="cursor: pointer;" width="60px" onClick="getDel(this)">删除</td></tr>');
	} else if(clValue == 'tbe_birth_control_measures'){
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="180px"><select name="colsValue" type="text" style="width:150px"><%=tbe_birth_control_measures%></select></td><td>'+conHtml+'</td><td style="cursor: pointer;" width="60px" onClick="getDel(this)">删除</td></tr>');
	} else if(clValue == 'tbe_es_reason'){
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="180px"><select name="colsValue" type="text" style="width:150px"><%=tbe_es_reason%></select></td><td>'+conHtml+'</td><td style="cursor: pointer;" width="60px" onClick="getDel(this)">删除</td></tr>');
	} else {
		$("#appendTable").append('<tr style="height:26px;"><td width="60px"><input name="colsName"  type="hidden" value="'+clValue+'">'+clName+'</td><td width="120px">'+$("#condition").html()+'</td><td width="180px"><input name="colsValue" type="text" style="width:150px"></td><td width="90px">'+conHtml+'</td><td width="60px" style="cursor: pointer;" onClick="getDel(this)">删除</td></tr>');
	}
}

/*
 * 删除条件-高级查询
 */
function getDel(ele){
	$(ele).parent().remove();  
}


function getBirthDay(ele){
	var val = getBirthDayFromID(ele.value);
	if(val != ''){
		$("#tbe_birthday").val(val);
	}
}

function checkIsVali(ele){
	var tbe_sex = $('#tbe_sex').val();
	if(tbe_sex == '男'){
		warningTip('男性员工不需要选择该项');
		var obj = document.getElementsByName('the_is_menopause');
		for(var i=0;i<obj.length; i++){
			if(obj[i].value == '0'){
				obj[i].checked = true;
				break;
			}
		}
	}
}

</script>
	</head>
	<body>
		<table class="serTable">
			<tr>
				<td>
					机构：<select id="org2" style=" width: 164px;">
						<%=user.getCurSubOrgOptions()%>
					</select>
				</td>
				<td>
					用工形式：<select id="ser5" style=" width: 164px;">
						<option value="">全部</option>
						<%=tbe_employment_forms%>
					</select>
				</td>
				<td>节育措施：<select id="ser6" style=" width: 164px;">
						<option value="">全部</option>
						<%=tbe_birth_control_measures%>
					</select>
				</td>
				<td><input class="btn2" value="搜索" type="button" onclick="serch1();" /></td>
			</tr>
			<tr>
				<td>姓名：<input id="ser1" style=" width: 160px;"/></td>
				<td>身份证：<input id="ser4" style=" width: 160px;"/></td>
				<td>是否晚婚：<select id="ser7" style=" width: 164px;">
						<option value="">全部</option>
						<option value="0">否</option>
						<option value="1">是</option>
					</select>
				</td>
				<td><input class="btn2" value="高级搜索" type="button" onclick="serch2();" /></td>
				
				<%
				if("3baf3bb603e04d0688053555b0234b46".equals(user.getUserId()) || "3df87eb3973f4eba8fa851686ceba0f6".equals(user.getUserId())
						|| "defd78b884d744dcb55f123638dfdd4d".equals(user.getUserId())){
				%>
				<td><input class="btn2" value="导出" type="button" onclick="expData();" /></td>
				<%
				}
				%>
			</tr>
		</table>
		
		<div id="emp-grid"></div>
		
		<div id="empAdd-div" style="display: none;">
			<form id="emp-form" name="emp-form">
				<input type="hidden" id="tbe_id" name="tbe_id" value="" />
				<input type="hidden" id="tbe_marital_status" name="tbe_marital_status" />
				<input type="hidden" id="tbe_political_status" name="tbe_political_status" value="" />
				<input type="hidden" id="reserve1" name="reserve1" value="" />
				<input type="hidden" id="reserve2" name="reserve2" value="" />
				<input type="hidden" id="reserve3" name="reserve3" value="" />
				<input type="hidden" id="reserve4" name="reserve4" value="" />
				<input type="hidden" id="reserve5" name="reserve5" value="" />
				<input type="hidden" id="create_by" name="create_by" value="" />
				<input type="hidden" id="create_time" name="create_time" value="" />
				<input type="hidden" id="last_modify_by" name="last_modify_by" value="" />
				<input type="hidden" id="last_modify_time" name="last_modify_time" value="" />
				<!--  暂时不用的字段-->
				<input type="hidden" id="tbe_mobile" name="tbe_mobile" value="" />
				<input type="hidden" id="tbe_age" name="tbe_age" value="0" />
				<input type="hidden" id="tbe_is_late_marriage" name="tbe_is_late_marriage" value="0" />
				<input type="hidden" id="tbe_marital_condition" name="tbe_marital_condition" value="" />
				<input type="hidden" id="tbe_seniority" name="tbe_seniority" value="0" />
				<input type="hidden" id="tbe_former_name" name="tbe_former_name" value="" />
				<input type="hidden" id="tbe_order" name="tbe_order" value="0" />
				<input type="hidden" id="tbe_birthplace" name="tbe_birthplace" value="" />
				<input type="hidden" id="tbe_graduate_college" name="tbe_graduate_college" value="" />
				<input type="hidden" id="tbe_major" name="tbe_major" value="" />						
				<input type="hidden" id="tbe_join_time" name="tbe_join_time" value="" />						
				<input type="hidden" id="tbe_ba_status" name="tbe_ba_status" value="" />
				<input type="hidden" id="tbe_children_status" name="tbe_children_status" value="" />
				<input type="hidden" id="tbe_is_late_birth" name="tbe_is_late_birth" value="0" />
				<input type="hidden" id="tbe_is_again_birth" name="tbe_is_again_birth" value="0" />
				<input type="hidden" id="tbe_married_time" name="tbe_married_time" value="" />
				<input type="hidden" id="tbe_marriage_certificate" name="tbe_marriage_certificate" value="" />
				<table class="form_table">
					<tr>
						<td colspan="9" align="left">
							<div style="border-bottom: 1px solid #EBEBEB; font-weight:bold;height: 28px; line-height: 28px;margin: 0 0 5px;" >
								<img src="ligerUI/skins/icons/communication.gif"/>
								<span>员工基础信息</span>
							</div>
						</td>
					</tr>
					<tr>
						<td class="form_label">所属机构：</td>
						<td>
							<%
								if("3baf3bb603e04d0688053555b0234b46".equals(user.getUserId())
										|| "3df87eb3973f4eba8fa851686ceba0f6".equals(user.getUserId())
										|| "defd78b884d744dcb55f123638dfdd4d".equals(user.getUserId())){
							%>
							<input id="org_id" name="org_id" type="hidden" />
							<input id="orgNameText" type="text" readonly="readonly" class="textbg1" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"/>
							<%
								} else {
							%>
							<select id="org_id" name="org_id" style=" width: 182px;height:22px" >
								<%=user.getCurSubOrgOptions()%>
							</select>
							<%
								}
							%>
						</td>
						<td><font color="red">*</font></td>
						<td class="form_label">员工姓名：</td>
						<td><input class="textbg1" id="tbe_name" name="tbe_name" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"/></td>
						<td><font color="red">*</font></td>
						<td class="form_label">身份证号：</td>
						<td><input class="textbg1" id="tbe_idcard" name="tbe_idcard" onblur="getBirthDay(this);"  onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"/></td>
						<td><font color="red">*</font></td>
					</tr>
					<tr>
					<td class="form_label">出生日期：</td>
						<td><input id="tbe_birthday" name="tbe_birthday" onkeyup="this.value=formatdata(this.value);"/></td>
						<td><font color="red">*</font></td>
					<td class="form_label">员工性别：</td>
						<td>
							<select id="tbe_sex" name="tbe_sex" style=" width: 182px;">
							</select>
						</td>
						<td></td>
						<td class="form_label">员工民族：</td>
						<td>
							<select id="tbe_nation" name="tbe_nation" style=" width: 182px;">
								<%=tbe_nation%>
							</select>
						</td>
						<td></td>
					</tr>
					<tr>
						<td class="form_label">员工籍贯：</td>
						<td><input class="textbg1" id="tbe_native_palce" name="tbe_native_palce"  onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"/></td>
						<td></td>
						<td class="form_label">家庭住址：</td>
						<td><input class="textbg1" id="tbe_address" name="tbe_address"  onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"/></td>
						<td></td>
						<td class="form_label">家庭电话：</td>
						<td><input class="textbg1" id="tbe_family_phone" name="tbe_family_phone"  onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"/></td>
						<td></td>
					</tr>
					
					<tr>
						<td colspan="9" align="left">
							<div style="border-bottom: 1px solid #EBEBEB; font-weight:bold; height: 28px; line-height: 28px;margin: 0 0 5px;" >
								<img src="ligerUI/skins/icons/communication.gif"/>
								<span>员工工作信息</span>
							</div>
						</td>
					</tr>
					<tr>
						<td class="form_label">职工证号：</td>
						<td><input class="textbg1" id="tbe_work_permit" name="tbe_work_permit"  onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"/></td>
						<td></td>
						<td class="form_label">员工职级：</td>
						<td>
							<select id="tbe_position" name="tbe_position" style=" width: 182px;">
								<option value="2">生产操作服务</option>
								<option value="1">专业技术管理</option>
							</select>
						</td>
						<td></td>
						<td class="form_label">员工职务：</td>
						<td><input class="textbg1" id="tbe_spell_code" name="tbe_spell_code" onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"/></td>
						<td></td>
					</tr>
					<tr>
						<td class="form_label">员工状态：</td>
						<td>
							<select id="tbe_status" name="tbe_status" style=" width: 182px;">
								<%=tbe_status1%>
							</select>
						</td>
						<td></td>
						<td class="form_label">用工形式：</td>
						<td>
							<select id="tbe_employment_forms" name="tbe_employment_forms" style=" width: 182px;">
								<%=tbe_employment_forms%>
							</select>
						</td>
						<td></td>
						<td class="form_label">参加工作：</td>
						<td><input id="tbe_work_area" name="tbe_work_area" onkeyup="this.value=formatdata(this.value);"/></td>
						<td></td>
					</tr>
					<tr>
						<td class="form_label">文化程度：</td>
						<td><input class="textbg1" id="tbe_qualification" name="tbe_qualification"  onMouseOver="this.style.borderColor='#4fa8e6'" onMouseOut="this.style.borderColor='#A1A3A1'"/></td>
						<td></td>
					</tr>
					<tr>
						<td colspan="9" align="left">
							<div style="border-bottom: 1px solid #EBEBEB; font-weight:bold; height: 28px; line-height: 28px;margin: 0 0 5px;" >
								<img src="ligerUI/skins/icons/communication.gif"/>
								<span>员工生育信息</span>
							</div>
						</td>
					</tr>
					<tr style="display: none;">
						<td class="form_label">重点对象：</td>
						<td align="left" id="tbe_is_es">
							<input style="margin-top: 2px; margin-left: 5px;" type="radio" name="tbe_is_es" value="1" />是
							<input style="margin-top: 2px; margin-left: 5px;" type="radio" name="tbe_is_es" value="0" checked="checked" />否
						</td>
						<td></td>
						<td class="form_label">重点时间：</td>
						<td><input id="tbe_es_time" name="tbe_es_time" onkeyup="this.value=formatdata(this.value);" style=" width: 182px; margin-left: 1px;"/></td>
						<td></td>
						<td class="form_label">重点理由：</td>

						<td><select id="tbe_es_reason" name="tbe_es_reason" style=" width: 182px; margin-left: 1px;">
						     <option value="0">-- 无 --</option>
						    <%=tbe_es_reason%>
						    </select></td>
						<td></td>
					</tr>
					<tr>
						<td class="form_label">节育措施：</td>
						<td>
							<select id="tbe_birth_control_measures" name="tbe_birth_control_measures" style="width:182px;">
								<%=tbe_birth_control_measures%>
							</select>
						</td>
						<td></td>
						<td class="form_label"><font color="#fe4365" style="font-weight: bold;">节育提示：</font></td>
						<td align="left" colspan="5"><font color="#fe4365" style="font-weight: bold;">男职工配偶非一汽职工，填写其配偶节育措施；女职工正常填写。</font></td>
						<td></td>
					</tr>
					<tr>
						<td class="form_label">绝经：</td>
						<td align="left" id="the_is_menopause">
							<input style="margin-top: 5px; margin-left: 5px;" type="radio" name="the_is_menopause" value="1" onclick="checkIsVali(this);" />是
							<input style="margin-top: 5px; margin-left: 5px;" type="radio" name="the_is_menopause" value="0" checked="checked"/>否
						</td>
						<td></td>
						<td class="form_label"><font color="#fe4365" style="font-weight: bold;">绝经提示：</font></td>
						<td align="left" colspan="5"><font color="#fe4365" style="font-weight: bold;">男职工此处不需要填写。</font></td>
						<td></td>
					</tr>
					<tr>
						<td class="form_label">不孕症：</td>
						<td align="left" id="tbe_is_barrenness">
							<input style="margin-top: 5px; margin-left: 5px;" type="radio" name="tbe_is_barrenness" value="1" />是
							<input style="margin-top: 5px; margin-left: 5px;" type="radio" name="tbe_is_barrenness" value="0" checked="checked"/>否
						</td>
						<td></td>
						<td class="form_label"><font color="#fe4365" style="font-weight: bold;">温馨提示：</font></td>
						<td align="left" colspan="5"><font color="#fe4365" style="font-weight: bold;">男职工配偶非一汽职工，配偶由于身体状况不能生育的，在此处填写。</font></td>
					<td></td>
					</tr>
					<tr>
						<td class="form_label">备注：</td>
						<td colspan="5"><textarea class="textbg3" style="margin-top: 5px;"cols='63'  id="tbe_memo" name="tbe_memo"  ></textarea></td>
					</tr>
				</table>
			</form>
		</div>
		
		<!-- 将用到的两个常用逻辑运算符初始化在页面中便于上面的使用  -->
		<div style="display: none;" id="condition">
			<select name="luojiOne">
				<option value="=">等于</option>
				<option value="<>">不等于</option>
				<option value=">">大于</option>
				<option value="<"">小于</option>
				<option value="is null">为NULL</option>
				<option value="like">包含</option>
				<option value="in">在...之中(1,2,3)</option>
				<option value="between">在...之间(1,2)</option>
			</select>
		</div>
		<div style="display: none;" id="conditionAnd">
			<select name="luojiTwo">
				<option value="and">与</option>
				<option value="or">或</option>
			</select>
		</div>
		<div id="tallSearch" style="display: none;">
			<table width="99%" height="100%">
				<tr>
					<td width="20%">字段列表</td>
					<td width="80%" style="text-algin: center;">
						<table width="100%">
							<tr>
								<td width="60px">字段名称</td>
								<td width="130px">条件匹配</td>
								<td width="150px">字段赋值</td>
								<td width="90px">条件关系</td>
								<td width="60px">移除操作</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<!-- select中给定的字段为数据库中字段，此处给出表明，是为了后台有多表查询时使用，但是此查询并不适合嵌套查询（子查询） 后台有统一替换过程  -->
					<td width="20%" style="vertical-align: top;">
						<select id="sel" style="height: 356px; width: 120px;" ondblclick="tallSearchCols(this.value);" multiple="multiple">
							<option value="tbe_name">姓名</option>
							<option value="tbe_sex">性别</option>
							<option value="tbe_idcard">身份证号</option>
							<option value="tbe_birthday">出生日期</option>
							<option value="tbe_nation">民族</option>
							<option value="tbe_native_palce">籍贯</option>
							<option value="tbe_address">家庭住址</option>
							<option value="tbe_family_phone">家庭电话</option>
							<option value="tbe_work_permit">职工证号</option>
							<option value="tbe_status">员工状态</option>
							<option value="tbe_employment_forms">用工形式</option>
							<option value="tbe_work_area">工作时间</option>
							<option value="tbe_marital_status">婚姻状态</option>
							<option value="tbe_married_time">结婚时间</option>
							<option value="tbe_marriage_certificate">结婚证号</option>
							<option value="tbe_is_late_marriage">是否晚婚</option>
							<option value="tbe_is_again_birth">是否允许再生育</option>
							<option value="tbe_is_barrenness">是否不孕症</option>
							<option value="the_is_menopause">是否绝经</option>
							<option value="tbe_is_es">是否重点服务对象</option>
							<option value="tbe_es_time">设为重点时间</option>
							<option value="tbe_es_reason">重点理由</option>
							<option value="tbe_birth_control_measures">节育措施</option>
							<option value="tbe_memo">备注</option>
						</select>
					</td>
					<td width="80%" style="text-algin: center;" valign="top">
						<table width="100%" id="appendTable">
						</table>
					</td>
				</tr>
			</table>
		</div>
		
		
	</body>
</html>










